# Description: With xf86-input-evdev, synaptics, vmmouse, wacom,  xf86-video-ati, fbdev, intel, nouveau, vmware.
# URL: nn
# Packager: milisarge
# Depends on: mtdev xorg-libxvmc xorg-server xcb-util xorg-xkeyboard-config xorg-twm xorg-term xorg-xclock xorg-xinit libevdev

name=xorg
version=7.7
release=9
section="driver"
source=()

build() {
cat > list.md5 << "EOF"
96d89d9406a02f5e36bdaa4edd9a243a  xf86-input-evdev-2.10.1.tar.bz2
4e3c8bed1ab4a67db2160c2c3d7e2a34  xf86-input-synaptics-1.8.3.tar.bz2
85e2e464b7219c495ad3a16465c226ed  xf86-input-vmmouse-13.1.0.tar.bz2
4597acd6ca57488b90369b81ce81efd0  xf86-input-wacom-0.32.0.tar.bz2
ede86cd3d1b1d8882f0aea61d9e924ed  xf86-video-ati-7.6.1.tar.bz2
3931c0e19d441cc576dc088f9eb9fd73  xf86-video-fbdev-0.4.4.tar.bz2
dc79910c7b9e32321cefc7af250c7765  xf86-video-nouveau-1.0.12.tar.bz2
a893c37c589f7a31cea929a5d896a0e2  xf86-video-vesa-2.3.4.tar.bz2
0cba22fed4cb639d5c4276f7892c543d  xf86-video-vmware-13.1.0.tar.bz2
EOF
unset MAKEFLAGS
for package in $(grep -v '^#' list.md5 |cut -d " " -f 3)
	do
		packagedir=$(echo $package | sed 's/.tar.bz2//')
		packagename=$(echo $package | sed 's/.tar.bz2//')
		case $packagename in
			xf86-input-wacom-[0-9]*)
				wget http://downloads.sourceforge.net/linuxwacom/$package;;
			*)
				wget http://mirror.switch.ch/ftp/mirror/X11/pub/individual/$section/$package;;
		esac
		grep $package list.md5 |md5sum -c -
		tar -xf $package

		pushd $packagedir
		case $packagename in
		xf86-input-vmmouse-[0-9]*)
			./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
            --with-udev-rules-dir=/lib/udev/rules.d \
            --without-hal-callouts-dir \
            --without-hal-fdi-dir;;
		xf86-video-intel-[0-9]*)		
			./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-kms-only;;
		xf86-input-wacom-[0-9]*)
			./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-systemd-unit-dir=no;;
		*)
			./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var;;
		esac
		make
		make DESTDIR=$PKG install
		popd
	done

# Intel is a bit different
wget  ftp://anduin.linuxfromscratch.org/BLFS/xf86-video-intel/xf86-video-intel-0340718.tar.xz
tar -xf xf86-video-intel-0340718.tar.xz
cd xf86-video-intel
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-kms-only \
--enable-uxa 
make 
make DESTDIR=$PKG install
}
